﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Zj.CourseManage.Domain.Events
{
    /// <summary>
    /// Event publisher interface
    /// </summary>
    public interface IEventPublisher:IDisposable
    {
        /// <summary>
        /// Publish event async
        /// </summary>
        /// <typeparam name="TEvent">The type of TEvent</typeparam>
        /// <param name="event">Event object</param>
        /// <returns></returns>
        Task PublishAsync<TEvent>(TEvent @event,CancellationToken cancellationToken=default(CancellationToken))
            where TEvent : IEvent;
    }
}
